In the field of e-mail messaging, formats for secure e-mail exchange have been proposed that permit signing of e-mail messages and their attachments. One such secure e-mail exchange format is defined by the secure MIME (S/MIME) standard for public key signing and encrypting of e-mail messages encapsulated in MIME (Multipurpose Internet Mail Extensions) using a PKI (Public Key Infrastructure). The PKI provides an S/MIME system with public key certificates that bind together an identity with a public key used to sign and/or encrypt an e-mail message, including any attachments.
To sign a message, a message sender uses the sender's private key (which is stored in a secure location) to encrypt a hash of the message and then send the message along with the sender's certificate (or a list of certificates for validating the validity of the certificate), which contains the sender's public key information. The recipient uses the received public key in the certificate to verify the message's digital signature.
To encrypt a message, a message sender obtains the recipient's public key, and uses the recipient's public key to encrypt the message and send the message, along with the recipient's certificate, to a receiver. The recipient will use the recipient's private key (which is stored securely somewhere that the recipient can access) to decrypt the message.
Some secure e-mail exchange formats allow for creation and formatting of a signed-only message and an enveloped(encrypted)-only message. In addition, these formats specify that signing and encrypting operations can be applied in any order. For example, signing can be performed before encrypting to create a signed-first-then-encrypted (signed-and-encrypted) message. Also, encrypting can be performed before signing to create an encrypted-and-signed) message.
As one example of a secure e-mail exchange format, and as specified by the S/MIME standard, a signed-only S/MIME message (clear-signed) contains a MIME body part that contains a MIME entity (i.e., the message content and attachment data) and a separate MIME body part that contains a signature (PKCS7 signature data). The MIME entity included in the message is signed by virtue of the separate signature that is included in the message. Before adding the signature to the signature MIME body part, Base64 transfer encoding is applied to the signature. The signature MIME body part has an “application/pkcs7-signature” content type, and a Base64 content transfer encoding.
The S/MIME standard is defined at RFC 3851, “S/MIME Version 3.1 Message Specification”, dated July 2004 (which obsoletes RFC 2633), RFC 3850, “S/MIME Version 3.1 Certificate Handling”, dated July 2004 (which obsoletes RFC 2632), and RFC 3852, “Cryptographic Message Syntax (CMS)”, dated July 2004 (which obsoletes RFC 3369, and is updated by RFC 4853), the contents of which are incorporated by reference herein
These secure e-mail exchange formats often specify that the signature (PKCS7 signature data, in the case of the S/MIME format) is created by using a digest algorithm to calculate a message digest for the entity that is to be signed, and then encrypting (i.e., signing) the message digest value using the signer's private key. The message digest value is the signature (again, PKCS7 signature data, in the case of the S/MIME format).
Because the clear-signed message includes a signature that is separate from the signed entity (i.e., the message content and attachment data), and because the signature is created using a message digest of the signed entity, a typical transmission of secure e-mail is often compelled to access attachment data twice. For example, the S/MIME system accesses the attachment data a first time to generate the attachment data to be sent, and the S/MIME system accesses the attachment data a second time to generate the message digest that is used to generate the signature.
When sending an attachment file with e-mail messages, secure e-mail systems typically read the entire attachment file into a memory buffer before generating and sending the e-mail message, to facilitate access to the attachment data. Examples of S/MIME systems that exhibit such behavior are believed to include Oyster S/MIME Open Source lib.